import java.io.*;
import java.security.*;

public class Skey_kb {
    public static void main(String[] args) throws Exception {
        FileInputStream f = new FileInputStream("key1.dat");
        ObjectInputStream b = new ObjectInputStream(f);
        Key k = (Key) b.readObject();
        byte[] kb = k.getEncoded();
        FileOutputStream f2 = new FileOutputStream("keykb1.dat");
        f2.write(kb);
        // 打印密钥编码中的内容
        for (byte i : kb) {
            System.out.print(i + ",");
        }

    }
}